//
//  JCClubMemberModel.m
//  SquashSpark
//
//  Created by 郭吉成 on 2017/11/28.
//  Copyright © 2017年 Coollang-YF. All rights reserved.
//

#import "JCClubMemberModel.h"
#import "NSString+Extension.h"

@implementation JCClubMemberModel

+ (JCClubMemberModel *)creatModelWithData:(NSDictionary *)dataDic{
    JCClubMemberModel *model = [JCClubMemberModel new];
    model.userID = [NSString checkIfNullWithString:dataDic[@"UserID"]];
    model.userName = [NSString checkIfNullWithString:dataDic[@"UserName"]];
    model.icon = [NSURL URLWithString:[NSString checkIfNullWithString:dataDic[@"Icon"]]];
    model.swings = [NSString checkIfNullWithString:dataDic[@"Swings"]].integerValue;
    model.duration = [NSString checkIfNullWithString:dataDic[@"Duration"]].integerValue;
    model.maxSpeed = [NSString checkIfNullWithString:dataDic[@"MaxSpeed"]].integerValue;
    return model;
}

+ (NSArray <JCClubMemberModel *>*) creatRankClubList:(NSArray *)sourceArray{
    NSMutableArray *array = [NSMutableArray array];
    for (NSDictionary *rankDic in sourceArray) {
        JCClubMemberModel *model = [self creatModelWithData:rankDic];
        [array addObject:model];
    }
    return array.mutableCopy;
}

@end
